import axiosObj from "./interceptor.js";


export default function(orderId, price) {
    console.log(orderId)
    axiosObj.get("/alipay/toPay?orderid=" + orderId[0].orderId + "&price=" + price + "&title='支付沙箱'")
        .then(response => {
            if (response.data.code === 1000) {
                // 创建一个新窗口，并获取其引用
                let newWindow = window.open('', '_blank');
                // 将后端返回的 form 数据写入新窗口中
                newWindow.document.write(response.data.data);
                // 关闭新窗口时，将其引用设为 null
                newWindow.onunload = function () {
                    newWindow = null;
                };
            } else {
                this.$message.error(response.data.msg);
            }
        }).catch(error => {
        this.$message.error(error)
    })


}